<!DOCTYPE html>
<html>

<head>
    <title>计算器</title>
    <meta charset="UTF-8">
    <style>
        body {
            background-color: #f2f2f2;
            font-family: Arial, sans-serif;
        }

        .container {
            width: 300px;
            margin: 0 auto;
            padding: 20px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
            border-radius: 5px;
        }

        input[type="button"] {
            width: 50px;
            height: 50px;
            background-color: #ccc;
            border: none;
            border-radius: 5px;
            font-size: 24px;
            cursor: pointer;
            margin: 5px;
        }

        input[type="text"] {
            width: 100%;
            height: 50px;
            font-size: 24px;
            padding: 5px;
            margin-bottom: 10px;
            box-sizing: border-box;
        }
    </style>
</head>

<body>
    <div class="container">
        <input type="text" id="result" readonly>
        <input type="button" value="1" onclick="addToResult(1)">
        <input type="button" value="2" onclick="addToResult(2)">
        <input type="button" value="3" onclick="addToResult(3)">
        <input type="button" value="+" onclick="addToResult('+')">
        <br>
        <input type="button" value="4" onclick="addToResult(4)">
        <input type="button" value="5" onclick="addToResult(5)">
        <input type="button" value="6" onclick="addToResult(6)">
        <input type="button" value="-" onclick="addToResult('-')">
        <br>
        <input type="button" value="7" onclick="addToResult(7)">
        <input type="button" value="8" onclick="addToResult(8)">
        <input type="button" value="9" onclick="addToResult(9)">
        <input type="button" value="*" onclick="addToResult('*')">
        <br>
        <input type="button" value="0" onclick="addToResult(0)">
        <input type="button" value="." onclick="addToResult('.')">
        <input type="button" value="C" onclick="clearResult()">
        <input type="button" value="/" onclick="addToResult('/')">
        <br>
        <input type="button" value="=" onclick="calculate()">
    </div>
    <script>
        function addToResult(value) {
            document.getElementById("result").value += value;
        }

        function clearResult() {
            document.getElementById("result").value = "";
        }

        function calculate() {
            var result = eval(document.getElementById("result").value);
            document.getElementById("result").value = result;
        }
    </script>
</body>

</html>